package com.x.erp.dao;

import com.x.erp.thirdparty.ModelMappingXy;
import com.x.framework.dao.BaseDao;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

/**
 * 与行圆车型关系映射
 */
@Repository
public class ModelMappingXyDao extends BaseDao{
	
private final static String selectXyModelListSql = "SELECT T1.* FROM ERP_MODEL_MAPPING_XY T1 WHERE 1=1 ";
	
	public List<ModelMappingXy> selectXyModelList(ModelMappingXy modelMappingXy) throws Exception{
		StringBuilder sb = new StringBuilder(selectXyModelListSql);
		List<Object> params = new ArrayList<Object>();
		if(this.isNotNull(modelMappingXy.getModelId())){
			sb.append("AND T1.MODEL_ID = ? ");
			params.add(modelMappingXy.getModelId());
		}
		if(this.isNotNull(modelMappingXy.getXyModelId())){
			sb.append("AND T1.XY_MODEL_ID = ? ");
			params.add(modelMappingXy.getXyModelId());
		}
		return this.queryForList(sb.toString(), ModelMappingXy.class, params);
	}

}
